package com.lzq.leetcode.hoot100;

import com.lzq.leetcode.hoot100.ds.ListNode;

public class s141 {

    public boolean hasCycle(ListNode head) {
        if (head == null)   return true;
        ListNode slow = head, fast = head;
        while (slow.next != null && fast.next.next != null) {
            head = head.next;
            fast = fast.next.next;
            if (head == fast) {
                return true;
            }
        }
        return false;

    }
}
